@isTest

Private class WorkflowCloneControllerTest{


    static testMethod void test_WorkflowTest()

    {
            Workflow_Definition__c WD = new Workflow_Definition__c();
            //WD.name = 'WD';
            WD.Status__c = 'Active';
            WD.Workflow_Name__c = 'WD';
            insert WD;

            PageReference pageRef = Page.WorkflowClonePage;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController ctrl = new ApexPages.StandardController(WD);
            WorkflowCloneController controller = new WorkflowCloneController(ctrl);

            Assignment_Group_Name__c AG = new Assignment_Group_Name__c();
            AG.name = 'AG1';
            AG.Function__c = 'Advertiser Approval';
            AG.Type__c = 'Fulfillment';
            AG.Description__c = 'Description';
            AG.Round_Robin__c = true;
            insert AG;
                        
            Workflow_Activities__c WA = new Workflow_Activities__c();
            WA.name = 'WA1';
            insert WA;
                                              
            Stage_Definition__c STD = new Stage_Definition__c();
            STD.name = 'Advertiser Approval';
            STD.Stage_Description__c = 'Desc';
            STD.Sequence__c = 83;
            STD.Status__c = 'Active';
            STD.Unique_Function__c = 'My Test12';
            insert STD;
            
                        
            Workflow_Stage__c WFS = new Workflow_Stage__c();
            WFS.name = 'WFS';
            WFS.Stage__c = STD.id;
            WFS.Sequence__c = 1;
            WFS.Workflow_Code__c = WD.id;
            insert WFS;
            
            WF_Assignment_Group__c WAG = new WF_Assignment_Group__c();
            WAG.Workflow_Function__c = WFS.id;
            WAG.AG_Definition__c = AG.id;
            insert WAG;
            
            Step_definition__c ST = new Step_definition__c();
            ST.name = 'SD1';
            ST.Stage__c = STD.id;
            ST.Step_Sequence__c = 55;
            ST.Target_Days__c = 4;
            ST.Dashboard_Function__c = '';
            ST.status__c='Active';
            insert ST;
            
            Wokflow_Steps__c WST = new Wokflow_Steps__c();
            WST.name = 'WST';
            WST.Wokflow_Stage_Name__c = WFS.id;
            WST.Required__c = true;
            WST.Step__c= ST.id;
            WST.sequence__C = 1;
            WST.Dashboard_Function__c ='ASW';
            WST.Target_Days__c= 11;
            insert WST;

            //Assignment_Group_Name__c AG = new Assignment_Group_Name__c(name='SG1',Description__c='Desc',);
            
            Activities_Definition__c APD = new Activities_Definition__c();
            APD.name = 'Advertiser Approval';
            APD.Required__c = True;
            APD.Status__c = 'Active';
            APD.Step__c = ST.id;
            insert APD;
        //    controller.Stages[0].selectbox = true;
      //      controller.Stages[0].SD = STD;
            controller.selectStages();
            controller.selectedSteps();
            controller.saveGroup();
            controller.saveUpdatedWFDefn();
            controller.saveFunctions();
        }
}